Can DbDefence be used to encrypt SQL code?

Yes. DbDefence encrypts your database entirely, including all data and stored procedures. If you would like to only encrypt the SQL code, consider using SQL Shield