As the discussion above shows, it all depends on what you mean by "will it work"!
In this particular case and according to my quick glance at the data sheet, the SFRs on the PIC18F2550 and the PIC18F4550 are at the same addresses (including the config registers) and so the program will probably fit into the 'other' device and it will not crash because it is accessing the wrong SFR when it refers to a specific address but that does not equate to "working" in my opinion.
Also, the hardware will "save you" a bit in that if you refer to a port in one device that is not implemented in the other, then writing will be silently ignored and reading will return a 0. Also the software does not care which pin a port bit is connected to: it assumes that the hardware design has taken that into account. But that also does not equate to "working" for me.
If you look at the table at the bottom of Page 1 of the data sheet you will see that there are distinct physical differences in 4 of the columns between the 2 devices. This is probably why Microchip have developed and sell 2 different devices rather than just make 1 and stamp a different label on them.
However, in general, trying to use the HEX file form one device in another is asking for troubles, if not destroying the device.
My question back to the OP is why would you want to do this? If you have the source then just recompile it for the correct device. If you don't have the source then this is probably a very dangerous way to go and should not be considered.
Susan