Data Analytics SQL Query method I need every 13th row as new column. I am not sure how this can be done using Pivot or transpose. Number of rows are not fixed. 

Please guide me the way.
Thanks

Data is as shown below where every 4 row gets repeated


ID &nbsp;  Value
AA &nbsp;   A
BB &nbsp;   B
CC &nbsp;   C
AA &nbsp;   D
BB &nbsp;   E
CC &nbsp;   F
AA &nbsp;   G
BB &nbsp;   H
CC &nbsp;   I



 it should be as below 



ID  &nbsp; Value1 &nbsp;Value2 &nbsp;   Value3 
AA &nbsp;   A &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  D &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  G 
BB &nbsp;   B &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  E &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  H 
CC &nbsp;   C &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    F &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    I
You can try PIVOT, something like this:

DECLARE @t TABLE ( ID CHAR(2), Value CHAR(1) )

INSERT INTO @t
SELECT *
FROM (
VALUES
( 'AA', 'A' ),
( 'BB', 'B' ),
( 'CC', 'C' ),
( 'AA', 'D' ),
( 'BB', 'E' ),
( 'CC', 'F' ),
( 'AA', 'G' ),
( 'BB', 'H' ),
( 'CC', 'I' )
)   x ( y, z )

SELECT *
FROM
    (
    SELECT *, ROW_NUMBER() OVER( PARTITION BY ID ORDER BY [VALUE] ) rowId
    FROM @t
    ) x
PIVOT ( MAX( Value ) FOR rowId In ( [1], [2], [3] ) ) pvt


My results: