SQL Script To Rename An Existing SQL Server Database

se Master
Go

Sp_DbOption <Current_Database>, ‘Single User’, True
Go

Exec Sp_ReNameDb ,
Go

Sp_DbOption <New_Database_Name>, ‘Single User’, False
Go

Note: You must restart or refresh the Query Analyzer to view the name change