Infinite loop in CURSOR
Probably you're moving the row when you set Deleted=1 and reading it again with your FAST_FORWARD cursor.  Use a STATIC cursor instead, which will iterate a copy of the data, and avoid mutating the data structure you are traversing.

DECLARE st CURSOR LOCAL STATIC FOR . . .