Let's say you have a list of shapefiles and the field name for the attribute is the same in each shapefile. That means you can make the SQL query in the beginning of the script, so the first bit could look like this:
search_id = arcpy.GetParameterAsText(0)
shps = [r"path\to\shp1.shp",r"path\to\shp2.shp"]
output_shp = r"path\to\output.shp"
field = "ID_FIELD_NAME"
sql = '"{0}" = \'{1}\''.format(field,search_id)
Here are two ways to go about your selection process. The first uses a where clause in the MakeFeatureLayer() and GetCount(), and the second uses a SearchCursor() to find the attribute and proceeds to MakeFeatureLayer(). I'm not sure which one is faster, but my guess is the second. Most likely, the speed is very similar if you don't have tons of shapefiles.
for shp in shps:
# make feature layer
if arcpy.Exists("fl"):
arcpy.management.Delete("fl")
fl = arcpy.management.MakeFeatureLayer(shp,"fl",sql)
# check count of features in new feature layer, skip to next shp if it == 0
if int(arcpy.management.GetCount(fl).getOutput(0)) == 0:
continue
# copy features, only happens if there is a feature in the feature layer
arcpy.management.CopyFeatures(fl,output_shp)
and here's the second. In this one, a SearchCursor is used to check for the presence of the feature, and then the MakeFeatureLayer() is used. I think this would probably be the faster way:
for shp in shps:
# use list comprehension with a SearchCursor to check for the id
all_ids = [r[0] for r in arcpy.da.SearchCursor(shp,field)]
if not search_id in all_ids:
continue
# now make feature layer and copy features
if arcpy.Exists("fl"):
arcpy.management.Delete("fl")
fl = arcpy.management.MakeFeatureLayer(shp,"fl",sql)
# copy features
arcpy.management.CopyFeatures(fl,output_shp)
EDIT:
With differing field names, you can store them and iterate the shapefiles like this:
shps = [(r"path\to\shp1.shp","ID_FIELD_NAME1"),
(r"path\to\shp2.shp","ID_FIELD_NAME2")]
output_shp = r"path\to\output.shp"
for item in shps:
shp = item[0]
field = item[1]
sql = '"{0}" = \'{1}\''.format(field,search_id)
#continue with the rest of the code as above