Variables as column names

Is there a way to use a variable as a column name.
I have tried a number of things and can not get it to work.

DECLARE @Name1 AS VARCHAR(50) = {{table3.selectedRow.data[1].PropertyName}};
DECLARE @TS1 AS VARCHAR(60) = {{table3.selectedRow.data[1].PropertyName ? table3.selectedRow.data[1].PropertyName + " - TimeStamp" : NULL}};

select t1.DeviceID
, t1.Value as {{table3.selectedRow.data[0].PropertyName}}
, t2.Value as @Name1
, t1.CreatedOn as {{table3.selectedRow.data[0].PropertyName ? table3.selectedRow.data[0].PropertyName + " - TimeStamp" : NULL}}
, t2.CreatedOn as @TS1

Thats the notable chunks out of the query.

Hi @craigzych! Is this for an MSSQL query?

What is the use case? Are you hoping to display existing SQL data with dynamic column names?

Yea exactly. If I do like below it works exactly as expected, but replacing that with {{table3.selectedRow.data[0].PropertyName}} throws an error

select t1.DeviceID
, t1.Value as 'Amps'

I was able to get the desired result by using a JS transform afterwards, but I feel like thats significantly less efficient.
delete Object.assign(data, {[{{table3.selectedRow.data[0].PropertyName}}]: data['NAME0'] })['NAME0'];

@craigzych Do you know if you have prepared statements disabled on your resource?

If so, can you try {{"'"+table3.selectedRow.data[0].PropertyName+"'"}} like the below example: