The query processor for Adaptive Server version 15.0.2 defers the optimization of statements in a stored procedure until it executes the statement.
Deferring the optimization of statements benefits the query processor because the values for local variables are available for optimization for their respective statements.
Earlier versions of Adaptive Server used default guesses for selectivity estimates on predicates using local variables.