Good ideas about the cursor declaration. Yes, it's declared LOCAL. And although the proc does not modify the table that the cursor is reading, I'm planning to try a superfluous STATIC declaration when I get back in the office, just to see if that flushes the problem.
I'm curious how you recode this logic to a set-based approach:
Cursor thru InputTable
Fetch next into @MyVar
while MoreData
Exec API_proc @MyVar
Fetch next into @MyVar
wend
Of course I can build my own cursor:
Instead of.....Declare Cursor for Select xyz............. I can say.....Select Xyz into #Temp..........
Then instead of .........Fetch/Process/FetchNext.......... I can say ....... select top 1 from #Temp/process/Delete (that row) from #Temp/Select Top1 from #Temp
which is technically set-based but probably not what you meant.