Declare @Myparam as Varchar(50) Set @MyParam = 'TableName' Select * from A_Table as T1 Left join @MyParam as T2 on T2.Id=T1.Id