Generating scala code and "evaluating" it (by that, you mean compiling then executing) is certainly possible, but not very sensible. The scala compiler is very slow - just look at a scala projects build times compared to a java app. That said, if you're able to cache the compilation, then it's not so bad. I'm not sure of your particular use case, but a similar use case would be that the layout for a site is a scala template stored in a database. If, when the app starts up, you compile the template and keep that reference to the compiled template, and then whenever the template is updated you recompile as well as save it to the database, then that should be fine, as long as you're not updating the template every few seconds.
So if you want an example of this, the best place to look is the Twirl tests:
Note that you'll need to write the template out to a temporary file, as well as needing working directories to generate the compiled template to and for the scala compiler to write its class files out to.