No, this does not prevent SQL injection attacks. Every time you dynamically create SQL, either on the client side or with EXEC inside the stored proc, you run the risk.
Parameterized queries are the preferred way to enter your query into a query.
source
share