Try either of the following:
SELECT
GL.AccountId,
CA.Code,
CA.AccountName,
SUM(CASE GL.DrCr WHEN 2 THEN Amount END) AS Debit,
SUM(CASE GL.DrCr WHEN 1 THEN Amount END) AS Credit,
Sum(CA.OpeningBalance + CASE GL.DrCr WHEN 2 THEN Amount END - CASE GL.DrCr WHEN 1 THEN Amount END) as Balance
FROM GeneralLedgerLine GL
Join ClientAccount CA on CA.Id = GL.AccountId
Join GenralLedgerHeader GH on GL.GeneralLedgerHeaderId = GH.Id
GROUP BY
GL.AccountId, CA.Code, CA.AccountName
OR
SELECT
AccountId,
Code,
AccountName,
Debit,
Credit,
Sum(OpeningBalance + Debit - Credit) as Balance
FROM ( SELECT
GL.AccountId,
CA.Code,
CA.AccountName,
SUM(CASE GL.DrCr WHEN 2 THEN Amount END) AS Debit,
SUM(CASE GL.DrCr WHEN 1 THEN Amount END) AS Credit,
SUM(CA.OpeningBalance) AS OpeningBalance
FROM GeneralLedgerLine GL
Join ClientAccount CA on CA.Id = GL.AccountId
Join GenralLedgerHeader GH on GL.GeneralLedgerHeaderId = GH.Id
GROUP BY
GL.AccountId, CA.Code, CA.AccountName
) AS SubQuery
The reason you are getting an error is because your are defining the name for the column and attempting to reference it in the same operation, which is not possible as of SQL Server 2017. If you either convert your reference to the calculated value (shown in the top code block) or if you do your calculation on the calculated columns in an outer query (shown in bottom code block) you shouldn't have an issue.
EDIT: Sorry was doing this quickly from my phone yesterday while waiting in the doctor's office. Queries corrected.