You have to make sure the boot address in SOPC builder is that specific onchip memory. That hex file is probably wiped clean on purpose (since you are not targetting it, the compiler gives you a clean slate).
In the system library select that onchip memory, compile your software, then compile your hardware in quartus. Another thing to keep in mind is depending on the memory you selected (512, M4k, MRAM) you may have different options available (or lack of options). If my memory is correct, to have pre-populated onchip RAM you can't use MRAM (but I think it's ok with onchip ROM in MRAM but don't quote me on that one). If that's an issue for you take a look at the Tri memory document up on the Altera site.