How to extract characters from a string stored as json data and place them in dynamic number of columns in Sql server : Hi I have a column of string in sql server that stores Json data with all the braces and colons included. My problem is to extract all the key and value pairs and store them in separate columns with the key as the column header. What makes this challenging is that every record has different number of key/value pairs. For example in the image below showing 3 records, the first record has 5 key/value pairs- EndUseCommunityMarket of 2, EndUseProvincial Market of 0, and so on. The second record has 1 key/value pair, and the third record has two key/value pairs.
[![enter image description here][1]][1]

If I have to show how I want this in excel it would be like:
[![enter image description here][2]][2]

I have seen some Sql examples that does something similar but for a fixed number of columns, unlike this one it varies for every record.

Please I need a sql that can achieve this as I am working on thousands of records. Thanks.

  [1]: https://i.stack.imgur.com/QoUOa.png
  [2]: https://i.stack.imgur.com/9eGxp.png