create table tb(id int)
insert tb select 1 union select 2
go
declare @tb nvarchar(100)
set @tb='tb'
exec('declare cur cursor for select id from '+@tb+' where id<10')
open cur
declare @id int
fetch next from cur into @id
while @@fetch_status=0
begin
print @id
fetch next from cur into @id
end
deallocate cur
go