Without knowing your data structure I am guessing here, however, I've created my own below
CREATE TABLE [dbo].[Test](
[dtime] [datetime] NULL,
[tag] [int] NULL,
[value] [int] NULL
) ON [PRIMARY]
Your logger is storing data every 5 seconds so the records will be unique for a given datetime and hence you can use the avg or sum and it will still return the actual value so the pivot will look something like
select * from test pivot (sum(value) for tag in ([1],[2],[3])) as tagvalue where dtime > '2017-12-20'
My test data is something like
dtime tag value
2017-12-20 11:30:00.000 1 2
2017-12-20 11:30:00.000 2 5
2017-12-20 11:30:00.000 3 8
and this will give a result of
2017-12-20 11:30:00.000 2 5 8
You mention a timestamp, Im assuming it is a datetime field not a timestamp field as timestamp are unique for each record and you will not be able to pivot it.