A self-employed contractor has been fined after an employee was killed when the trench he was working in collapsed on him.