Equivalent of varchar(max) in ASE
ASE's (var)char max is 16384. (assuming ASE 15.x/16.x)
If the query can be broken into chunks, with each chunk no larger than 16K, then you could try concatenating them inside the execute() call.
From the documentation for the execute() command:

There are no restrictions to the number of characters supplied with
the literal string.

And from Example 6 (same link) we see a simple example:
execute ('select ' + @columname + ' from ' + @tablename + ' where id=3')