Check if command exists before execution