The key words that normally can't be used, and how you can override that, is documented in the User Guide in the chapter on Excel reports under the heading "Protecting the Database". It doesn't call out PIVOT, but it does call out SET and EXECUTE which are both in your query.
↧