your if statement stuff would work, absolutely;
what i was implying, is you could possibly rebuild the synonym every time, something like this:
--Usage EXEC GetData 'SERVERNAME'
Create Procedure GetData(@WhichServer varchar(30))
declare @isql varchar(8000)
--i don't care if it has the same value or not, just rebuild my synonym dynamically
SELECT isql = 'IF OBJECT_ID(''dbo.DistantObjects'', ''SN'') IS NOT NULL DROP SYNONYM dbo.DistantObjects;'
SELECT isql = 'CREATE Synonym DistantObjects FOR ' + QUOTENAME(@WhichServer) + '.master.dbo.sysobjects'
select * from DistantObjects
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!