You need to check whether the new element is already in the array before adding it, so that you only get unique elements. And to prevent that warning about the undefined index, you need to initialize the element if it doesn't exist yet.
foreach ($servico as $data) {
if (!isset($result[$data['id']])) {
$result[$data['id']] = array();
}
if (!in_array($data['name'], $result[$data['id']])) {
$result[$data['id']][] = $data['name'];
}
}