Yes and no. It highly depends on many factors. In principle, in some processors architectures, code can be isolated the way it cannot be read in any other way except actually executing this code, which is, of course, does not fully reveal the content of the code memory.
(Some changes of state of the processor can be done strictly one-way. For example, with Intel x86/I64 architectures, it's possible to protect some memory segment which nothing can ever read, no matter in what protection ring
. The segment can only be removed, by re-setting the processor or removing power supply.)
In simple processors, this is not the case. Also, the answer depends on what do you call "stored" and what is "in microprocessor". The code executed in microprocessor is not normally stored on it at all. It is stored in RAM, outside the processor.
The exclusion is microcode
(please see the reference below). Are your talking about some non-volatile memory
? Usually, the RAM information which can be protected the way I explained, is stored only when the power is supplied. Some code can be stored in non-volatile memory which is logically act as RAM (example is BIOS, which has volatile and non-volatile memory, another thing is UEFI
, which can be considered as BIOS
So, non-volatile memory outside processor can be read by at least one simple reason: it does not have to be attached to the CPU at all, at the same time, it is preserved when power is off. However, microcode could be totally protected, as its functionality does not require reading its context at all; its execution is engaged only when processor's instructions are get executed, so the presence of microcode is completely hidden from an outside observer.
Some information, just for general understanding: