TBD-1054 fixed: Generate the stored procedure code