It is going to be a problem with your WHERE clause in
query = "Select * from Win32_Service where Name like '" & pattern & "' AND ServiceType = 'Own Process' OR ServiceType='Interactive Process'"
For a start you have a mixture of AND and OR without using brackets to define your meaning. Try this instead (note the open & close brackets)
query = "Select * from Win32_Service where Name like '" & pattern & "' AND ( ServiceType = 'Own Process' OR ServiceType='Interactive Process' ) "
If you are still not getting all the results you expect after that then check your input for
pattern