A method to prepare epitaxial layers of ordered alloys by sputtering is described. The B2-ordered FeRh compound is used as an example, as it displays a metamagnetic transition that depends sensitively on the degree of chemical order and the exact composition of the alloy.