It depends a bit on what you want to do with this, but one possible way to solve this is to use the Microsoft.JScript assembly. Although JScript is a tad different from c#, much of the syntax is the same or similar. What's more, JScript is based on a global scope, so no need to wrap the code you generated in a method either.
In steps you would do the following:
- modify the code you got from the database to be valid JScript (using string methods and probably a lot of Regex)
- Get an instance of a JScript compiler
- Compile the code to an assembly
- Run the assembly with some inputs.
But since this is rather heavy on the creation of types/assemblies (that might not be unloadable), I would recommend (using the above method) compiling a simple wrapper for the jscript eval() function, and simply providing your jscript to that code. Then you won't have to worry about compilation etc.
Be carefull when creating dynamic code though. The whole of the .Net framework would be avaliable for use, so unless you absolutely trust the source of the conditions, or restricted the compiled assembly, nasty stuff™ could happen.