CREATE PROCEDURE STATUS_GET_EXP
@app_id char(10)
as
begin
 
 declare @SQL nvarchar(2000)
 SET @SQL = ‘ SELECT   SUM(DATEDIFF(yyyy, app_exp_from, app_exp_to)) AS exp_years FROM APP_EXPERIENCE WHERE (app_id = ”’+@app_id+”’)’
 print @SQL
 exec(@SQL)
end

GO