You can use
SELECT @@SERVERNAME
SELECT SERVERPROPERTY('servername')
See BOL for details
>Hi, I need to run a stored procedure on 3 different servers.
>For this, I need to know which server a stored procedure runs.
>I used
>
>EXEC master..xp_getnetname @cServerName OUTPUT
>
>this works for our development and live server.
>
>However, our development and testing server are in the same machine.
>The configuration is something like this.
>
>Develop: zeta
>Test: zeta\testing.
>
>When I issued EXEC master..xp_getnetname @cServerName OUTPUT on both develop and test, the result is 'zeta'.
>
>Is there a stored procedure which returns the full name like 'zeta\testing'?
>
>Again xp_getnetname returns only upto the machine name.
--sb--