create procedure proc_Country_ProvincesInfo
@SERVERNAME
varchar(max)
@DISTRIBUTEDDBNAME
varchar(max)
@countryname
varchar(max))
as
begin
Declare @SQLSTATEMENT NVARCHAR(MAX)
SET @SQLSTATEMENT='select Provinces from '+@SERVERNAME+'.'+@DISTRIBUTEDDBNAME+'.[dbo].TableName where countryname=@countryname'
EXEC SP_EXECUTESQL @SQLSTATEMENT
end