SAP ASE matches an ad hoc SQL statement to a cached statement by the SQL text and by login (particularly if both users have sa_role), user ID, database ID, and session state settings.
The relevant session state consists of settings for these set command parameters:
forceplan
jtc
parallel_degree
prefetch
quoted_identifier
table count
transaction isolation level
chained (transaction mode)
Settings for these parameters determine the behavior of the plan SAP ASE produces for a cached statement. See the Reference Manual: Commands.