Вдруг, кому-то потребуется
declare commands cursor for
SELECT * from table_name
declare
cmd varchar(max)
open commands
fetch next from commands into @cmd
while @@FETCH_STATUS=0
begin
exec (@cmd)
fetch next from commands into @cmd
end
close commands
deallocate commands