Please help me with my problem of data representation.

I have some SQL script, that creates the following data presentation:

```
Declare params cursor for 
Select distinct id_variable from [UIR_DB].[dbo].[Variable_Values]
open params
Declare @idparam int
Declare @csql nvarchar(max)  = ''
Declare @csql2 nvarchar(max)  = ''
declare @csq13 nvarchar(max) = ''
Declare @i int = 1
fetch next from params into @idparam
while @@FETCH_STATUS = 0
begin
Select @csql2 = @csql2 +', id_var'+LTRIM(Str(@i))+ ', param' +LTrim(Str(@i))
Select @csql =  ' (Select id_variable as id_var'+LTrim(Str(@i))+', value as param'+LTrim(Str(@i))+' from
[UIR_DB].[dbo].[Variable_Values] where id_variable = '+LTrim(Str(@idparam))+') a'+LTrim(Str(@i))+'
cross join'+@csql
Set @i = @i+1
fetch next from params into @idparam
end
Select @csql = 'Select '+SubString(@csql2,2,LEN(@csql2)-1)+' from
'+SubString(@csql,1,LEN(@csql)-11)+'order by'+SubString(@csql2,2,LEN(@csql2)-1)
print @csql
exec sp_executesql @csql
close params
deallocate params

```

![execute Script 1](https://i.stack.imgur.com/MmQob.png)

My knowledge of SQL not so far, so please, if it wouldn't be a big problem, i need script, that will creates the next data representation from Script1 results:
![New script results](https://i.stack.imgur.com/PEGbS.png)