Fortunately, Microsoft SQL Server helps us in this situation giving us a feature that allows us to reference a different server and use it to make queries against it.
So, let's open SQL Server Management Studio, get in to the server and go to "Linked Servers" folder located in "Server Objects".
Now, you have to create a new linked server by using the right-click button and the appropriate option.
In this ocasion, just type the linked server name on the textbox and select the type of this, keep in mind that you can connect to other sources different from SQL Server.
After you do this, on the "Security" section you hace to specify the mapping between users and for the rest of users you'll have to select the connection mode.
Once you finish this, you will be able to query the data from your new linked server, this will appear under the "Linked Servers" folder. Since now you can build this kind of queries:
SELECT * FROM TEMP.CATALOGTEMP.DBO.TEMPTABLE