Writing dynamic SQL query in LOOKER

I currently need to write a dynamic SQL query because I need to pivot a column based on the distinct values that appear in a given column (and I do not want to manually specify which of these values I want pivoted as there are many). I tried writing a dynamic query but SQL query runner does not seem to be able to process it.

Is there anyway I can work around this?

The dynamic SQL query will look something like in this website:

https://anthonysmoak.com/2018/08/05/how-to-dynamically-pivot-data-in-sql-server/

Thank you!

https://docs.looker.com/exploring-data/exploring-data#:~:text=Looker%20supports%20up%20to%20200,and%20click%20the%20pivot%20icon.&text=To%20unpivot%20results%2C%20click%20the,again%20in%20the%20field%20picker.