The escape for a single quote is an additional single quote.
The problem you will have is trying to escape single quotes on the fly. There was another question about how to do that not too long ago and the best answer I could come up with was to use a recursive function. Slow and not available prior to v15 unless you ahve the Java option bought and paid for in 12.x
I would take a much simpler approach: turn off quoted identifiers and use double quotes around the outside of the text.
Regards,
Bill