Question: how to change database name in sql query?
Answer: In Object Explorer, connect to your SQL instance. Make sure that there are no open connections to the database. ...  In Object Explorer, expand Databases, right-click the database to rename, and then click Rename. Enter the new database name, and then click OK.