To discover the network name of the server that SQL is physically located on, the extended stored procedure xp_getnetname can be used.
On its own it simply returns a result set containing the netname of the server, however it can be used within a sql script by including the following code:
declare @netname varchar(100)
exec master..xp_getnetname @netname OUTPUT
print @netname