No, this should not be done in SQL. It's not uncommon to do dynamic pivots in SQL Server, although it is a non-relational operation. But you are taking things one step further by having multiple columns for the same header value.
Yes, I am sure we can write some ugly dynamic SQL for this, but you are looking for a presentational device, and that belongs in the presentation layer. So have SQL Server return a relational result set, and let Python or whatever do the formatting.