This is a very short example:
:Setvar _servername "SANDY.sqladmin.lan"
:CONNECT $(_servername)
SELECT
N'$(_servername)' AS [_servername]
,SERVERPROPERTY('SERVERNAME') AS [servername];
SQL Server administration, infrastructure, automation, instrumentation etc.
:Setvar _servername "SANDY.sqladmin.lan"
:CONNECT $(_servername)
SELECT
N'$(_servername)' AS [_servername]
,SERVERPROPERTY('SERVERNAME') AS [servername];