create table ttt
(
aa nvarchar(50)
)
declare @TableName nvarchar(50)
declare cursor_1 cursor for select name from sysobjects where xtype='U'
open cursor_1
fetch next from cursor_1 into @TableName
while @@fetch_status=0
begin
exec ('if (select count(*) from '+@TableName+')=0 insert into ttt values ('''+@TableName+''')')
fetch next from cursor_1 into @TableName
end
select * from ttt
drop table ttt
close cursor_1
deallocate cursor_1