Add ability to decrypt fields

```
`%(function)s` in `sql_template` is populated by `sql_function`.
```