If you want to have access to data stored in a different server, one of the ways to do so is to make that server as a Linked Server to the current server and then query using the linked server name. Let us assume that there is a server named test available over the network and you want to get some data from there. System stored procedure sp_addlinkedserver can be used to create a linked server and fire distributed queries.
EXEC sp_addlinkedserver test
If you want to know if the connection to the linked server is accessible, you can make use of system stored procedure sp_testlinkedserver as shown below
EXEC sp_testlinkedserver test
It simply checks if the connection is successful. If the result is "Command(s) completed successfully.", it means the connection is successful. This is the simplest way to check if the linked server is accessible
Also check Viewing Linked Server Information in SQL Server 2005/2008