SELECT
 (T_SAL.MatriculeSalarie + ' ' + isnull(T_SAL.Nom, '') + ' '  + isnull(T_SAL.Prenom, '') ) as Col1,
  'Portabilité prévue du ' + CONVERT(VARCHAR(12),T_HST_INFOSSOCIETE.DateDepart, 103) + ' au ' + CONVERT(VARCHAR(12),DATEADD(MONTH,9,T_HST_INFOSSOCIETE.DateDepart),103) as Col2
FROM
  T_PAI,
  T_SAL
  LEFT OUTER JOIN T_HST_INFOSSOCIETE ON T_HST_INFOSSOCIETE.NumSalarie=T_SAL.SA_CompteurNumero
                  AND T_HST_INFOSSOCIETE.InfoEnCours=1
  LEFT OUTER JOIN T_HST_ETABLISSEMENT ON T_HST_ETABLISSEMENT.NumSalarie=T_SAL.SA_CompteurNumero
                  AND T_HST_ETABLISSEMENT.InfoEnCours=1                  
Where   ( (CURRENT_TIMESTAMP >= DATEADD(DAY,ISNULL(-%NbJoursAvant%,0),DATEADD(MONTH,9,T_HST_INFOSSOCIETE.DateDepart))
		 and CURRENT_TIMESTAMP <= DATEADD(DAY,ISNULL(%NbJoursApres%,0),DATEADD(MONTH,9,T_HST_INFOSSOCIETE.DateDepart))
         ) and 
        ( T_HST_ETABLISSEMENT.PortabiliteCouverture = 1 and T_HST_ETABLISSEMENT.EtatPaieComplementaire = 2))
Order by T_SAL.MatriculeSalarie