• I found what was wrong with:

    "CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st":

    I worked in SSMS / SQL Server 2005 connected to a database having "Compatibility level: SQL Server 2000 (80)".

    Either connecting to the master database or changing to "Compatibility level: SQL Server 2005 (90)" did the job.

    Thanks, Leendert.