Here is an example of cursor.

VB Code:
  1. declare @a varchar(100)
  2.  
  3. declare c1 cursor for select name from sysobjects where name like 'x%'  
  4.  
  5. open c1
  6. fetch next from c1 into @a
  7. while @@fetch_status =0
  8. begin
  9.     print @a
  10.     fetch next from c1 into @a
  11. end
  12.  
  13. close c1
  14. deallocate c1

Here we know the cursor SQL string. In case if I try to convert it as an SP and how do I iterate through the columns of the query which are passed dynamically?

Thanks,
Jai