I have a table named Sample which looks like.

I want the output as following 
for this I have built the following Query:
SELECT YEAR/MONTH, 1L,3L,4L,6L,8L
FROM (
SELECT PANEL, LAYERCOUNT, MONTHS
FROM Sample) up
PIVOT (SUM(Count) FOR CountOFL IN (1L,3L,4L,6L,8L)) AS pvt
ORDER BY YEAR/MONTH
But it gives error Incorrect syntax near ‘1’.

For the table structures you gave, this query would return the pivoted table on the CountOFL column:
Results:
So, you need to enclose the values of the PIVOTed column in square brackets.