Last six months on columns mysql

Try something like this

SELECT
  sR.codigo,
  SUM(sR.cant_ser * (YEAR(CURDATE()) * 12 + MONTH(CURDATE()) - YEAR(pg.fecha_pago) * 12 - MONTH(pg.fecha_pago) = 5)) MONTH6,
  SUM(sR.cant_ser * (YEAR(CURDATE()) * 12 + MONTH(CURDATE()) - YEAR(pg.fecha_pago) * 12 - MONTH(pg.fecha_pago) = 4)) MONTH5,
  SUM(sR.cant_ser * (YEAR(CURDATE()) * 12 + MONTH(CURDATE()) - YEAR(pg.fecha_pago) * 12 - MONTH(pg.fecha_pago) = 3)) MONTH4,
  SUM(sR.cant_ser * (YEAR(CURDATE()) * 12 + MONTH(CURDATE()) - YEAR(pg.fecha_pago) * 12 - MONTH(pg.fecha_pago) = 2)) MONTH3,
  SUM(sR.cant_ser * (YEAR(CURDATE()) * 12 + MONTH(CURDATE()) - YEAR(pg.fecha_pago) * 12 - MONTH(pg.fecha_pago) = 1)) MONTH2,
  SUM(sR.cant_ser * (YEAR(CURDATE()) * 12 + MONTH(CURDATE()) - YEAR(pg.fecha_pago) * 12 - MONTH(pg.fecha_pago) = 0)) MONTH1
FROM db1_pagos pg
LEFT JOIN db1_servicios sR ON (sR.id_pro = pg.id_pro)
WHERE pg.fecha_pago >= LAST_DAY(CURDATE() - INTERVAL 7 MONTH) + INTERVAL 1 DAY
AND pg.status_pago = 'SALDADO'
GROUP BY sR.codigo