1.Create database with same name as MDF file you have.

USE [master]

GO

ALTER DATABASE [MyDatabase] SET EMERGENCY

GO

ALTER DATABASE [MyDatabase] SET SINGLE_USER

GO

2.Stop SQL Server and swap MDF files. Make sure you also keep new database you just created.

3.Start SQL Server. Database will be now in suspect state because log file is not correct.

4.Run the following script:

USE [master]

DBCC CHECKDB ([MyDatabase], REPAIR_ALLOW_DATA_LOSS)

GO

ALTER DATABASE [MyDatabase] SET MULTI_USER

GO

ALTER DATABASE [MyDatabase] SET ONLINE

GO

}