Replace raw SQL with generated statements when sending event