IF CURSOR_STATUS('global', 'mycursor') >= 0
BEGIN
PRINT 'Cursor exists and is open';
END
ELSE
BEGIN
PRINT 'Cursor does not exist or is not open';
END;


REF:https://stacktuts.com/how-to-check-if-cursor-exists-open-status-in-sql
IF CURSOR_STATUS('global', 'mycursor') >= 0
BEGIN
PRINT 'Cursor exists and is open';
END
ELSE
BEGIN
PRINT 'Cursor does not exist or is not open';
END;


REF:https://stacktuts.com/how-to-check-if-cursor-exists-open-status-in-sql