How to fix sp_cursorprepexec 'parameter value is invalid' in SQL Server

SQL-Server

When tracing with SQL Profiler, it returned a query using 'sp_cursorprepexec'. When executing the same query within SSMS, it failed with:

sp_cursorprepexec: The value of the parameter XX is invalid.

I managed to solve this by adding '+ 0x1000' to the parameter.