You might want to go with Reflection.Emit
. A nice, but maybe a bit outdated tutorial, can be found at this site. Also take a look at MSDN - they have great documentation!
What you generally would like to do is to mark each method (or a whole class) with an attribute and for each such a method/class with an attribute create a wrapping method, and replace the code. You could make it run on application initialization or on the first call to this class/method, the design is up to you.
This is no easy task, but actually we had the same case in our project, and it proved to be quite a good solution. That's because each method with a given attribute required a similar handling.
Keep in mind that there are some alternative approaches to code emitting, but I do not know them well, so I cannot provide any suggestions - but it'd be easily googlable.
Reflection.Emit
with IL by itself is quite troublesome, but certainly it allows you to learn a deal more about what's going on in your c# code, under the hood.