if object_id('tb') is not null
drop table tb
go
create table tb(id int)
insert into tb
select 1 union all
select 4 union all
select 3 union all
select 1 union all
select 1 union all
select 1 union all
select 1 union all
select 1 union all
select 1 union all
select 1
declare @str nvarchar(500)
declare @table nvarchar(10)
set @table='tb'
set @str='select * from '+@table
exec (@str)