[TIPS] – SQL Server: how to rename the @@SERVERNAME of your SQL instance


Little “tips” to end the day, we will see how to rename the variable @@SERVERNAME of your SQL instance. If like me, once your SQL Server deployed, optimized as it should and ready to do battle with your developers, you notice that the server name does not match the “naming Charter” business…

You have two choices, first you can decide to format everything and start from scratch, or you can change the names properly 🙂

Yes, it is possible to rename it once SQL Server installed :

  1. Out the AD server
  2. Rename the server
  3. Integrate the server with your AD
  4. Follow the procedure below for SQL

Since SSMS, run the following query to check the value of @@SERVERNAME:


Then enter the following commands:

sp_addserver <NEW_SERVERNAME>, local;</NEW_SERVERNAME>


Restart the SQL  instance from SSMS (right click on the instance and then restart) and control by typing the first command again.

If all goes well your SQL instance has now the good server name.