For quite a while, to rename a database, you could just execute the system stored procedure called ‘sp_renamedb':

EXEC sp_renamedb 'OldName', 'NewName'

At one point though, as I understood it, the word was that it would not be supported after 2005.

The ‘new way is :

ALTER DATABASE [OLDName] MODIFY NAME = [NEWName]

Well, after investigating (I don’t find the need to rename databases that often), I have found, that in SQL Server 2008, either one will work. However, what you need to be aware of is that, with the ‘new’ way, you must be in single user mode, for exclusivity. You can accomplish this, the rename and the reversion back to multi-user mode like this:

ALTER DATABASE [OLDName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [OLDName] MODIFY NAME = [NEWName]
ALTER DATABASE {NEWName] SET MULTI_USER