As long as you have only one table in your SQL query, you can use the ISRLOCKED() function as one of you columns.
select *,isrlocked() as locked from mytable intocursor c_temp
However, do not use this with a multi-table query because aliases don't work consistently with SQL select statements and the ISRLOCKED() function will get confused without the alias.