Avoid Functions/Procedures with a complex SELECT clause (SQL Server) | CAST Appmarq