SET @sql = NULL;
SELECT
  GROUP_CONCAT(DISTINCT
               CONCAT('MAX(IF(`timestamp` = "', `timestamp`,'", `hours_amount`,0)) AS "',DATE_FORMAT(timestamp, '%W %d/%m'),'"')
              ) INTO @sql
FROM (SELECT * FROM ForecastEmployeeShifts where pointOfSaleseId = 53 and WEEKOFYEAR(timestamp) > WEEKOFYEAR(curdate())) t1;


SET @sql = CONCAT('SELECT s.`department_name`,  ', @sql, '
                  FROM (SELECT * FROM ForecastEmployeeShifts where pointOfSaleseId = 53 and WEEKOFYEAR(timestamp) > WEEKOFYEAR(curdate())) s
                 GROUP BY s.`department_name`
                 ORDER BY s.`department_name`');
#SELECT @sql;
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;