'Dynamically use date data type as a variable

I am trying to use date data type as a variable in a select query , I would want to replace the date column name dynamically by declaring it as a variable but this fails with a syntax error.

DECLARE @DATE_VAR VARCHAR(10) SET @DATE_VAR = 'Visit_date'
--print @date_var

SELECT @DATE_VAR from Maternity_DB.dbo.Visit_table
WHERE @Date_Var> getdate() - 10


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source