Star Trek: The Next Generation: Season 6, Episode 9
Stardate: 46315.2. Data discovers that the maintenance robots built by Dr. Farallon may have become sentient.