To identify the leads of a transistor the DMM (Digital Multimeter) DIODE function is used.
For an NPN BJT connect the meter POSITIVE lead to a transistor lead. Connect the meter NEGATIVE terminal to each of the other two transistor leads. If approximately 0.7 volts is measured for each of the two terminals the meter POSITIVE is connected to the transistor BASE lead. Which of the two terminals is the EMITTER and which is the COLLECTOR? I have found that usually the lead with the lower voltage is the EMITTER, but this might not always be true.
Many digital multimeters have a diode test position that provides a convenient way to test a transistor. A typical DMM, as shown in the figure below, has a small diode symbol to mark the position of the function switch. When set to diode test, the meter provides an internal voltage sufficient to forward-bias and reverse-bias a transistor junction.
Whenever possible, the transistor casing will have some marking to indicate which leads are connected to the emitter, collector, or base of a transistor. A few of the methods commonly used are indicated in the figure below.