How do you return the connection name via TSQL? This is visible in SSMS via the properties window. For example if you have a DNS alias "ProductionServer" for a machine named "SRVR0001" and further have a local server registration for this named "Live Production" and then
1) Open a new query providing a Server name of "ProductionServer" then the connection name will be "ProductionServer" 2) Right click the local registration and select new query, the connection name will be "Live Production"
And of course in both instances
select @@SERVERNAME will return SRVR0001.
This is similar, but different, to these questions:
I anticipate the answer may well be that this is a local property held by SSMS, and thus can not be returned by TSQL run on SQL Server.