Renaming a db fails in MSSQL as it is not in single user mode by default and hence exclusive lock cannot be obtained. Use the following script to put the DB in single user mode -> rename it and then restore it to multiuser mode.
USE master
ALTER DATABASE [Original DB Name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [Original DB Name] MODIFY NAME = [Renamed DB Name]