There are six sheriffdoms in Scotland and each sheriffdom is headed by a Sheriff Principal who is usually a Queen’s Counsel. They are supported by permanent or resident sheriffs. The main role of sheriffs is to sit as a trial judge (but they have some appellate functions). Sheriffs are either advocates or solicitors; many are also Queen’s Counsel.
A Sheriff Principal is 'Sheriff Principal Macklin' and a Sheriff 'Sheriff Macklin'. Verbally they are addressed as 'My Lord/Lady'.