As delnan already mentioned, any program is just data until the processor attempts to run it.
To practice self-modifying code, perform the following steps:
- copy
notepad.exe
to notepad_orig.exe
- start
notepad_orig.exe
- open
notepad.exe
in the now opened notepad window
- type whatever you want
- save and close
A stupid example perhaps, but there's nothing more happening here. Notepad takes an external data source (you!) to change its code.
If you are looking for algorithms, I suggest you look for a framework that provide automatic updates to an application. It's the only practical example I can think of that's not illegal.
In a response to your comment, you could of course encrypt a portion of your application, and decrypt it before it is used. However for an application to run, it has to exist in memory in its decrypted form, and can be read. You will probably only make your application harder to maintain.