So you’ve renamed your SQL Server, but something isn’t right.

Returns the old name.

The fix is simple.

You just need to restart the SQL instance and @@servername will return the correct name.

More info on the Microsoft Docs.

On a similar note, Octopus Deploy has similar annoyance, the server name doesn’t update for the server node. Again simple fix for this simple annoyance:

The other thing that can get missed is the SQL Jobs.