Noether's second theorem for BRST symmetries