How to choose an alternative for a specific BJT transistor?
Look at the obvious things first: how much voltage and current must the transistor handle in the circuit? How much power must it dissipate? Any transistor that meets these specs will probably work to some degree.

Then look at lower-level details such as current transfer ratio (does the circuit only work with a certain minimum gain?) and capacitance values (especially in high-frequency circuits).

Does the circuit exploit some particular feature of the specified transistor? If so, you'll need to verify that your replacement transistor behaves similarly.