it appears this is a case of needing to "embed" the single quotes within a quoted string. Anytime a sql statement is embedded in a "string" all items normally single-quoted require an extra one.
here is an example using two single quotes together based on your query: WHERE type_desc not in (''SERVER_ROLE'' , ''CERTIFICATE_MAPPED_LOGIN'')
try adding the extra single quote to the items in the where clause that are already single-quoted.
does this make sense? I hope I did not make it more confusing.